var PoliceWorkMap={
	mapBoss:null,
	init:function(mapBoss){
		var boss = this;
		boss.mapBoss = mapBoss;
	},
	renderLayer:function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		var zoom = mapBoss.map.getZoom();
		var jwtag = $(".menuList li.selected").attr("tag");
		
		if(jwtag=='zddw'){
			boss.renderZddwSingleLayer(zoom);
			return;
		}
		
		if(jwtag=='poi'){
			boss.renderPoiLayer(zoom)
			return;
		}
		
		if(jwtag == 'chuzuwu' || jwtag == 'zdry'){
			boss.renderChuzuwuLayer(zoom);
		}
		
		if(jwtag=='camera'){
			boss.renderCamera(zoom)
			return;
		}
		
		if(jwtag == "camerahouse"){
			boss.renderCameraHouse(zoom);
			return;
		}
	},
	renderPoiLayer:function(zoom){
		var boss = this;
		if(zoom <= 15){
			boss.renderPoiCenterLayer();
		}
		else{
			boss.renderPoiSingleLayer();
		}	
	},
	renderChuzuwuLayer:function(zoom){
		var boss = this;
		if(zoom <= 15){
			boss.renderCenterLayer();
		}
		else{
			boss.renderSingle();
		}
	},
	renderCamera:function(zoom){
		var boss = this;
		if(zoom <= 18){
			boss.renderCameraCenterLayer();
		}
		else{
			boss.renderCameraSingle();
		}	
	},
	renderCameraHouse: function(zoom){
		var boss = this;
		if(zoom <= 18){
			boss.renderCameraHouseCenterLayer();
		}else{
			boss.renderCameraHouseSingle();
		}
	},
	renderCenterLayer:function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		mapBoss.clearMapOverLay();
		var zoom = mapBoss.map.getZoom();
		var level;
		var pid = $("#xuanxiangka div[tag^='z'][selected]").last().attr("fullid");
		var zddw = $(".menuList li.selected").attr("tag") == "zddw"?"zddw":"";
		var jwtag = $(".menuList li.selected").attr("tag");
		if(zoom <=13 ){
			level = 1;
		}
		else if(zoom == 14){
			level = 2;
		}
		else if(zoom == 15){
			level = 3;
		}
		else if(zoom == 16){
			level = 4;
		}
		else if(zoom == 17){
			level = 5;
		}
		else if(zoom == 18){
			level = 6;
		}
		if(jwtag == "chuzuwu"){
			mapBoss.loadCenterLayer(burl+"/Apartment/getCenterCount.do",{"orgid":pid,"level":level,"zddw":zddw},"栋",boss.showCenterWindow,boss.MarkerApartment);
		}
		else if(jwtag=="zdry"){
			mapBoss.loadCenterLayer(burl+"/Apartment/getCenterCount.do",{"orgid":pid,"level":level,"zddw":zddw},"栋",boss.showCenterWindow,boss.MarkerZDRYApartment);
		}
	},
	renderPoiCenterLayer:function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		mapBoss.clearMapOverLay();
		var zoom = mapBoss.map.getZoom();
		var level;
		var pid = $("#xuanxiangka div[tag^='z'][selected]").last().attr("fullid");
		var zddw = $(".menuList li.selected").attr("tag") == "zddw"?"zddw":"";
		var jwtag = $(".menuList li.selected").attr("tag");
		var poiType = $(".menuList li.selected").attr("poiType");
		if(zoom <=13 ){
			level = 1;
		}
		else if(zoom == 14){
			level = 2;
		}
		else if(zoom <=18){
			level = 3;
		}
		
		mapBoss.loadCenterLayer(burl+"/SspoiModel/getCenterCount.do",{"orgid":pid,"level":level,poiType:poiType},"个",null,null);
	},
	renderCameraCenterLayer:function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		mapBoss.clearMapOverLay();
		var zoom = mapBoss.map.getZoom();
		var level;
		var pid = $("#xuanxiangka div[tag^='z'][selected]").last().attr("fullid");
		if(zoom <=14 ){
			level = 2;
		}
		else if(zoom == 15){
			level = 3;
		}
		else if(zoom <= 18){
			level = 4;
		}
		mapBoss.loadCenterLayer(burl+"/Camera/getCenterCount.do",{"orgid@likeRight":pid,"level":level},"个",boss.showCameraCenterWindow,null);
	},
	renderCameraHouseCenterLayer: function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		mapBoss.clearMapOverLay();
		var zoom = mapBoss.map.getZoom();
		var level;
		var pid = $("#xuanxiangka div[tag^='z'][selected]").last().attr("fullid");
		
		if(zoom <= 14){
			level = 2;
		}else if(zoom <= 16){
			level = 3;
		}else if(zoom <= 18){
			level = 4;
		}
		mapBoss.loadCenterLayer(burl+"/CameraHouse/getCenterCount.do",{"orgid@like":pid,"level":level},"个",boss.showCameraHouseCenterWindow,null);
	},
	renderSingle:function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		var bound = mapBoss.map.getBounds();
		var miny = bound._swLat;
		var minx = bound._swLng;
		var maxy = bound._neLat;
		var maxx = bound._neLng;
		mapBoss.clearMapOverLay();
		mapBoss.overlay.myOverlay = [];
		var pid = $("#xuanxiangka div[tag^='z'][selected]").last().attr("fullid");
		var jwtag = $(".menuList li.selected").attr("tag");
		if(pid == "1"){
			pid = "";
		}
		if(!pid){
			pid = "";
		}
				
		sbl.ajax({
			dataType:'json',
			type:'get',
			data:{miny:miny,minx:minx,maxy:maxy,maxx:maxx,orgid:pid,jwtag:jwtag},
			url:burl+"/Apartment/getModelByOrgs.do",
			success:function(d){
				var tag = $(".menuList li.selected").attr("tag");
				for(var j=0;j<d.length;j++){
					var row = d[j];
					var point = new BMap.Point(row.MAPX,row.MAPY);
					var icon;
					if(row["ISZDRY"]){
						icon = new BMap.Icon(burl+"/images/map/zdry.png", new BMap.Size(32,32));
					}
					else{
						icon = new BMap.Icon(burl+"/images/map/wz"+sbl.getFieldValue(row.PACJHZDDW)+".png", new BMap.Size(32,32));
					}
					
					var Marker = new BMap.Marker(point);
					Marker.data = row;						
					Marker.addEventListener("click",function(){
						PoliceWorkMap.showApartmentInfoWindows(this);								
					});
					Marker.setIcon(icon);
					mapBoss.overlay.myOverlay.push(Marker);
					mapBoss.map.addOverlay(Marker);
				}
			}
		});
	},
	renderCameraHouseSingle: function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		var bound = mapBoss.map.getBounds();
		var miny = bound._swLat;
		var minx = bound._swLng;
		var maxy = bound._neLat;
		var maxx = bound._neLng;
		mapBoss.clearMapOverLay();
		mapBoss.overlay.myOverlay = [];
		var pid = $("#xuanxiangka div[tag^='z'][selected]").last().attr("fullid");
		
		 var myStyles1 = [{
	            url: burl+"/images/map/jw.png",
	            size: new BMap.Size(30, 30),
	            opt_anchor: [16, 0]
	        }];
		
		 sbl.ajax({
			 dataType: "json",
			 type: "get",
			 data: {miny: miny, minx: minx, maxy: maxy, maxx: maxx, 'orgid@likeRight': pid},
			 url: burl + "/CameraHouse/getModelsForMap.do",
			 success: function(d){
				 var data = d.data;
				for(var j=0;j<data.length;j++){
					var row = data[j];
					var point = new BMap.Point(row.LON,row.LAT);
					var icon = new BMap.Icon(burl+"/images/camera/camera_house.png", new BMap.Size(32,32));
					
					var Marker = new BMap.Marker(point);
					Marker.data = row;						
					Marker.addEventListener("click",function(){
						PoliceWorkMap.showCameraHouseInfoWindows(this);								
					});
					Marker.setIcon(icon);
					mapBoss.overlay.myOverlay.push(Marker);
					mapBoss.map.addOverlay(Marker);
				}
			 }
		 });
	},
	renderCameraSingle:function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		var bound = mapBoss.map.getBounds();
		var miny = bound._swLat;
		var minx = bound._swLng;
		var maxy = bound._neLat;
		var maxx = bound._neLng;
		mapBoss.clearMapOverLay();
		mapBoss.overlay.myOverlay = [];
		var pid = $("#xuanxiangka div[tag^='z'][selected]").last().attr("fullid");
				
		 var myStyles1 = [{
	            url: burl+"/images/map/jw.png",
	            size: new BMap.Size(30, 30),
	            opt_anchor: [16, 0]
	        }];
		
		sbl.ajax({
			dataType:'json',
			type:'get',
			data:{miny:miny,minx:minx,maxy:maxy,maxx:maxx,'orgid@likeRight':pid},
			url:burl+"/Camera/getModelsForMap.do",
			success:function(d){
				var tag = $(".menuList li.selected").attr("tag");
				var data = d.data;
				for(var j=0;j<data.length;j++){
					var row = data[j];
					var point = new BMap.Point(row.LON,row.LAT);
					var icon = new BMap.Icon(burl+"/images/camera/camera.png", new BMap.Size(18,20));
					
					var Marker = new BMap.Marker(point);
					Marker.data = row;						
					Marker.addEventListener("click",function(){
						PoliceWorkMap.showCameraInfoWindows(this);								
					});
					Marker.setIcon(icon);
					mapBoss.overlay.myOverlay.push(Marker);
					mapBoss.map.addOverlay(Marker);
				}
			}
		});
	},
	renderZddwSingleLayer:function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		var bound = mapBoss.map.getBounds();
		var miny = bound._swLat;
		var minx = bound._swLng;
		var maxy = bound._neLat;
		var maxx = bound._neLng;
		var markers = [];
		mapBoss.clearMapOverLay();
		mapBoss.overlay.myOverlay = [];
		var pid = $("#xuanxiangka div[tag^='z'][selected]").last().attr("fullid");
		var jwtag = $(".menuList li.selected").attr("tag");
		if(pid == "1"){
			pid = "";
		}
		if(!pid){
			pid = "";
		}
				
		 var myStyles1 = [{
	            url: burl+"/images/map/jw.png",
	            size: new BMap.Size(30, 30),
	            opt_anchor: [16, 0]
	        }];
		
		sbl.ajax({
			dataType:'json',
			type:'get',
			data:{miny:miny,minx:minx,maxy:maxy,maxx:maxx,orgid:pid,jwtag:jwtag},
			url:burl+"/Apartment/getModelByOrgs.do",
			success:function(d){
				for(var j=0;j<d.length;j++){
					var row = d[j];
					var point = new BMap.Point(row.mapx,row.mapy);
					var icon = new BMap.Icon(burl+"/images/map/jw.png", new BMap.Size(32,32));;
					var Marker = new BMap.Marker(point);
					Marker.data = row;						
					Marker.addEventListener("click",function(){
						this.map.boss.showApartmentInfoWindows(this);								
					});
					Marker.setIcon(icon);
					mapBoss.overlay.myOverlay.push(Marker);
					markers.push(Marker);
				}
				mapBoss.overlay.markerClustererLayer = new BMapLib.MarkerClusterer(mapBoss.map, {markers:markers});
				mapBoss.overlay.markerClustererLayer.setStyles(myStyles1);
				mapBoss.overlay.markerClustererLayer.setGridSize(200);
			}
		});
	},
	renderPoiSingleLayer:function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		var bound = mapBoss.map.getBounds();
		var miny = bound._swLat;
		var minx = bound._swLng;
		var maxy = bound._neLat;
		var maxx = bound._neLng;
		var markers = [];
		mapBoss.clearMapOverLay();
		mapBoss.overlay.myOverlay = [];
		var pid = $("#xuanxiangka div[tag^='z'][selected]").last().attr("fullid");
		var jwtag = $(".menuList li.selected").attr("tag");
		var poiType = $(".menuList li.selected").attr("poiType");
		if(pid == "1"){
			pid = "";
		}
		if(!pid){
			pid = "";
		}
		
		 var myStyles1 = [{
	            url: burl+"/images/map/jw.png",
	            size: new BMap.Size(30, 30),
	            opt_anchor: [16, 0]
	        }];
		
		sbl.ajax({
			dataType:'json',
			type:'get',
			data:{miny:miny,minx:minx,maxy:maxy,maxx:maxx,orgid:pid,poiType:poiType},
			url:burl+"/SspoiModel/getPoiListMap.do",
			success:function(d){
				for(var j=0;j<d.length;j++){
					var row = d[j];
					var point = new BMap.Point(row.MAPX,row.MAPY);
					var Marker = new BMap.Marker(point);
					Marker.data = row;						
					Marker.addEventListener("click",function(){
						PoliceWorkMap.showPoiInfoWindows(this);								
					});
					mapBoss.overlay.myOverlay.push(Marker);
					markers.push(Marker);
				}
				mapBoss.overlay.markerClustererLayer = new BMapLib.MarkerClusterer(mapBoss.map, {markers:markers});
				mapBoss.overlay.markerClustererLayer.setStyles(myStyles1);
				mapBoss.overlay.markerClustererLayer.setGridSize(200);
			}
		});
	},
	showCameraCenterWindow: function(overlay){
		var boss = PoliceWorkMap;
		var mapBoss = boss.mapBoss;
		var center = new BMap.Point(this.point.lng,this.point.lat);
		var jwtag = $(".menuList li.selected").attr("tag");
		
		var htmlContent = "<table class='mapWindowsTable'><tr>";
		htmlContent += "<td class='label'>" + this.data.DEPTNAME + "：</td><td class='value'>" + this.data.COUNT + "个</td>";
		htmlContent += "</tr></table>";
		
		var InfoWindow = new BMap.InfoWindow(htmlContent);
		mapBoss.map.openInfoWindow(InfoWindow, center);
	},
	showCameraHouseCenterWindow: function(overlay){
		var boss = PoliceWorkMap;
		var mapBoss = boss.mapBoss;
		var center = new BMap.Point(this.point.lng,this.point.lat);
		var jwtag = $(".menuList li.selected").attr("tag");
		
		var htmlContent = "<table class='mapWindowsTable'><tr>";
		htmlContent += "<td class='label'>" + this.data.DEPTNAME + "：</td><td class='value'>" + this.data.COUNT + "间</td>";
		htmlContent += "</tr></table>";
		
		var InfoWindow = new BMap.InfoWindow(htmlContent);
		mapBoss.map.openInfoWindow(InfoWindow, center);
	},
	showCenterWindow:function(overlay){
		var boss = PoliceWorkMap;
		var mapBoss = boss.mapBoss;
		var center = new BMap.Point(this.point.lng,this.point.lat);
		var jwtag = $(".menuList li.selected").attr("tag");
		var StatisticsModels;
		if(this.data.MAPXY){
			StatisticsModels = modelDao.getApartmentStatistics(this.data.ID,this.data.MAPXY)	
		}
		else{
			StatisticsModels = [{"BUILDING_TYPE":this.data.DEPTNAME,"COUNT":this.data.COUNT}];
		}
		var allCount = 0;
		
		var htmlContent = "<table class='mapWindowsTable'>";
		for(var i=0;i<StatisticsModels.length;i++){
			var StatisticsModel = StatisticsModels[i];
			if(StatisticsModel.BUILDING_TYPE){
				htmlContent += "<tr>";
				htmlContent += "<td class='label'>"+StatisticsModel.BUILDING_TYPE+":</td><td class='value'>"+StatisticsModel.COUNT+"栋</td>";
				htmlContent += "</tr>";
				allCount += StatisticsModel.COUNT;
			}
		}
		htmlContent += "<tr>";
		htmlContent += "<td class='label'>总计:</td><td class='value'>"+allCount+"栋</td>";
		htmlContent += "</tr>";
		if(jwtag != "zdry"){
			htmlContent += "<tr>";
			htmlContent += "<td class='label'>配备终端数:</td><td class='value'>"+Math.ceil(Math.random()*allCount)+"个</td>";
			htmlContent += "</tr>";
			htmlContent += "<tr>";
			htmlContent += "<td class='label'>安装App数:</td><td class='value'>"+Math.ceil((Math.random()*allCount)-1)+"个</td>";
			htmlContent += "</tr>";
		}
		
		htmlContent += "</table>";
		var InfoWindow = new BMap.InfoWindow(htmlContent);
		mapBoss.map.openInfoWindow(InfoWindow, center);
	},
	showApartmentInfoWindows:function(overlay,id){
		var boss = PoliceWorkMap;
		var mapBoss = boss.mapBoss;
		var model;
		if(!overlay){
			model = modelDao.getApartmentModel(id);
		}
		else{
			id = overlay.data.ID;
			model = modelDao.getApartmentModel(id);
		}
		
		var jwtag = $(".menuList li.selected").attr("tag");
		var point = new BMap.Point(model.MAPX, model.MAPY);
		var htmlContent = "<table class='infoWindowsTable'>";
		htmlContent += "<tr><td rowspan='10' style='width:50px'><img height='250px' width='180px' src='http://ba110.cn/"+sbl.getFieldValue(model.SMALLIMGURL)+"'></td></tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title' style='color:#FAA50B;width: 70px;'>涉毒人员个数:</td>";
		htmlContent += "<td class='value' apartmentId='"+id+"' id='showZdryList' colspan='3' style='text-decoration: underline;cursor: pointer;color:red;font-weight: bold;font-size: 19px;'>"+sbl.getFieldValue(model.ZDRY_COUNT)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent	+= "<td class='title'>是否全部出租:</td><td class='value'>"+sbl.getFieldValue(model.ZLFW)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title'>分管所领导:</td><td class='value'>"+sbl.getFieldValue(model.FGSLD)+"</td>";
		htmlContent += "<td class='title'>房屋数:</td><td class='value'>"+sbl.getFieldValue(model.HOUSECOUNT)+"间</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title'>视频门禁安装资金来源:</td><td class='value'>"+sbl.getFieldValue(model.AZMJLX)+"</td>";
		htmlContent += "<td class='title'>是否混合出租:</td><td class='value'>"+sbl.getFieldValue(model.LX)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title'>楼层数:</td><td class='value'>"+sbl.getFieldValue(model.CS)+"</td>";
		htmlContent += "<td class='title'>是否有电梯:</td><td class='value'>"+sbl.getFieldValue(model.SFPBDT)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title'>出租间套数:</td><td class='value'>"+sbl.getFieldValue(model.CZJTS)+"</td>";
		htmlContent += "<td class='title'>是否合围:</td><td class='value'>"+sbl.getFieldValue(model.SFWH)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title'>是否有简易消防设施:</td><td class='value'>"+sbl.getFieldValue(model.YWJYXFXX)+"</td>";
		htmlContent += "<td class='title'>是否有兼职楼管员:</td><td class='value'>"+sbl.getFieldValue(model.YWJZLGY)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title'>是否有门禁:</td><td class='value'>"+sbl.getFieldValue(model.YWMJ)+"</td>";
		htmlContent += "<td class='title'>有误视频监控:</td><td class='value'>"+sbl.getFieldValue(model.YWSP)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td  class='title'>地址:</td><td colspan='3' class='value'>"+sbl.getFieldValue(model.ADDR)+"</td>";
		htmlContent += "</tr>";		
		htmlContent += "<table>";
		
		var infoWindows = new BMap.InfoWindow(htmlContent);
		infoWindows.addEventListener("open",function(){
			$("#error_btn").bind("click",function(){
				window.open(burl+'/view/PoierrorEdit.aspx.htm','','height=610,width=1030,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no');
				infoWindows.close();
			});
			
			$("#showZdryList").bind("click",function(){
				var id = $(this).attr("apartmentId");
				PoliceWorkMap.ShowZdryGrid(id);
			});
		});
		mapBoss.map.openInfoWindow(infoWindows,point);
	},
	showCameraInfoWindows:function(overlay){
		var boss = PoliceWorkMap;
		var mapBoss = boss.mapBoss;
		var center = overlay.point;
		var htmlContent;
		sbl.ajax({
			url:burl+"/Camera/detailInMap.do?id="+overlay.data.ID,
			dataType:"text",
			async:false,
			success:function(data){
				htmlContent = data;
			}
		});
		var InfoWindow = new BMap.InfoWindow(htmlContent);
		mapBoss.map.openInfoWindow(InfoWindow, center);
	},
	showCameraHouseInfoWindows: function(overlay){
		var boss = PoliceWorkMap;
		var mapBoss = boss.mapBoss;
		var center = overlay.point;
		var htmlContent;
		sbl.ajax({
			url:burl+"/CameraHouse/detailInMap.do?id="+overlay.data.ID,
			dataType:"text",
			async:false,
			success:function(data){
				htmlContent = data;
			}
		});
		var InfoWindow = new BMap.InfoWindow(htmlContent);
		InfoWindow.addEventListener("open", function(){
			$("#camera_link").bind("click", function(){
				var id = $(this).attr("tag");
				boss.ShowCameraGrid(id);
			});
		});
		mapBoss.map.openInfoWindow(InfoWindow, center);
	},
	showPoiInfoWindows:function(overlay,id){
		var boss = PoliceWorkMap;
		var mapBoss = boss.mapBoss;
		var model;
		if(!overlay){
			model = modelDao.getPoiModel(id);
		}
		else{
			id = overlay.data.ID;
			model = modelDao.getPoiModel(id);
		}
		
		var jwtag = $(".menuList li.selected").attr("tag");
		var point = new BMap.Point(model.MAPX, model.MAPY);
		var htmlContent = "<table class='infoWindowsTable'>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title'>类型:</td><td class='value'>"+sbl.getFieldValue(model.CODENAME)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title'>描述:</td><td class='value'>"+sbl.getFieldValue(model.POINAME)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title'>电话号码:</td><td class='value'>"+sbl.getFieldValue(model.TEL)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='title'>地址:</td><td class='value'>"+sbl.getFieldValue(model.ADDR)+"</td>";
		htmlContent += "</tr>";
		htmlContent += "<table>";
		
		var infoWindows = new BMap.InfoWindow(htmlContent);
		mapBoss.map.openInfoWindow(infoWindows,point);
	},
	MarkerZDRYApartment:function(point,row,index,zoom){
		var boss = this;
		var Marker = new BMap.Marker(point);
		var zoom = boss.map.getZoom();
		Marker.data = row;
		var icon ;
		var imgUrl = burl+"/images/map/jj.png";
		if(zoom < 18){
			imgUrl = burl+"/images/map/jj.png";
		}
		else{
			imgUrl = burl+"/images/map/xiaoqu.png";
		}
		if(row.KPCOUNT != 0 && row.KPCOUNT != null && row.KPCOUNT != '' && index <= 7){
			if(index > 2){index = 2}
			icon = new BMap.Icon(burl+"/images/map/jingqing/"+(parseInt(index)+1)+".png", new BMap.Size(120,120));
		}
		else{
			icon = new BMap.Icon(burl+"/images/map/5.png", new BMap.Size(120,120));
		}
		var count = parseInt(row.COUNT);
		var label ;
		
		var labelContent = "<div class='centerDiv'>";
		labelContent += "<img width='70' height='50' src='"+imgUrl+"' /><br/>";
		labelContent += row.DEPTNAME+"<br><span style='font-size:20px'>"+sbl.getFieldValue(row.KPCOUNT,true)+"人</span><br/>";
		labelContent += "</div>";
		label = new BMap.Label(labelContent,{offset:new BMap.Size(12,8)});
		label.setStyle({"borderWidth":"0px","background":"","color":"white","fontSize":"14px"});
		
		Marker.setLabel(label);
		Marker.setIcon(icon);
		return Marker;
	},
	MarkerApartment:function(point,row,index,zoom){
		var Marker = new BMap.Marker(point);
		Marker.data = row;
		var icon = new BMap.Icon(burl+"/images/map/5.png", new BMap.Size(120,120));
		var imgUrl = burl+"/images/map/jj.png";
		if(zoom < 18){
			imgUrl = burl+"/images/map/jj.png";
		}
		else{
			imgUrl = burl+"/images/map/xiaoqu.png";
		}
		var count = parseInt(row.COUNT);
		var labelContent = "<div class='centerDiv'>";			
		labelContent += "<img width='70' height='50' src='"+imgUrl+"' /><br/>";
		labelContent += row.DEPTNAME+"<br><span style='font-size:20px'>"+row.COUNT + "栋</span><br/>";
		labelContent += "</div>";
		var label = new BMap.Label(labelContent,{offset:new BMap.Size(12,8)});
		label.setStyle({"borderWidth":"0px","background":"","color":"white","fontSize":"14px"});
		Marker.setLabel(label);
		Marker.setIcon(icon);
		return Marker;
	},
	ShowZdryGrid:function(id){
		sbl.dialog({
			url:burl+"/view/apartment/ZdryGrid.jsp",
			width:"750px",
			height:"350px",
			OnComplete:function(){
				$("#zdryGridDiv").WidgetGrid({
					url:burl+"/Apartment/getZdryGrid.do",
					Data:{id:id},
					columns:[
					         {text:"姓名",field:"ZDRY_NAME"},
					         {text:"身份证号码",field:"SFZH"},
					         {text:"研判状态",field:"YP_STATUS"},
					         {text:"调度状态",field:"TZ_STATUS"},
					         {text:"签收反馈状态",field:"QSFK_STATUS"},
					         {text:"地址",field:"HDFS_PLACE"}
					        ]
				});	
			}
		});
	},
	ShowCameraGrid: function(id){
		sbl.dialog({
			width: 700,
			height: 500,
			contentDivId: "camera_dialog",
			OnComplete: function(){
				ManagerGrid.grid({
					url: burl + "/Camera/getEasyList.do",
					Data: {camerahouseid: id},
					columns: [{
						text: "地址",field: "cameraAddress"
					}, {
						text: "采集人", field: "creatername"
					}, {
						text: "采集时间", field: "createtime"
					}]
				}, "camera_dialog");
			}
		});
	}
};